package com.lvmama.controller.system;

import com.lvmama.common.result.Result;
import com.lvmama.pojo.base.Page;
import com.lvmama.pojo.dto.rhino.system.RoleDTO;
import com.lvmama.pojo.dto.rhino.system.RoleQueryDTO;
import com.lvmama.pojo.entity.rhino.system.Role;
import com.lvmama.service.system.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName : RoleController
 * @Description : 角色管理
 * @Author :Administrator
 * @Date : 2018/8/23 19:26
 * @Version V1.0
 **/
@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;
    @PostMapping("getRolePage")
    public Result<Page<Role>> getRolePage(@RequestBody RoleQueryDTO queryDTO){
        return roleService.queryRolePage(queryDTO);
    }
    @PostMapping("getRoleInfo")
    public Result getRoleInfo(@RequestBody RoleQueryDTO queryDTO){
        return roleService.queryRoleInfo(queryDTO);
    }
    @PostMapping("saveRoleByRoleDTO")
    public Result saveRoleByRoleDTO(@RequestBody RoleDTO roleDTO){
        return roleService.saveRoleByRoleDTO(roleDTO);
    }
    @PostMapping("updateRoleByRoleDTO")
    public Result updateRoleByRoleDTO(@RequestBody RoleDTO roleDTO){
        return roleService.updateRoleByRoleDTO(roleDTO);
    }
    @PostMapping("getRoleById")
    public Result<Role> getRoleById(@RequestBody String id){
        return roleService.queryRoleById(id);
    }
    @PostMapping("getRoleMenusByRoleId")
    public Result<Role> getRoleMenusByRoleId(@RequestBody String id){
        return roleService.selectRoleMenusByRoleId(id);
    }
    @PostMapping("deleteRoleById")
    public Result<Boolean> deleteRoleById(@RequestBody String id){
        return roleService.deleteRoleById(id);
    }
    @PostMapping("getRoleList")
    public Result<List<Role>> getRoleList(@RequestBody RoleQueryDTO queryDTO){
        return roleService.queryRoleList(queryDTO);
    }
}
